import 'dart:math';

import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';
import 'package:meal/constant/antd_icons.dart';
import 'package:meal/constant/fonts.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 进行中活动
///
class ProceedGroup extends StatefulWidget {
  const ProceedGroup({Key? key}) : super(key: key);

  @override
  State<ProceedGroup> createState() => _ProceedGroupState();
}

class _ProceedGroupState extends State<ProceedGroup> {
  late ScrollController scrollController;

  bool isLoading = false;

  bool noMore = false;

  @override
  void initState() {
    super.initState();
    scrollController = ScrollController()
      ..addListener(() {
        if (!isLoading &&
            !noMore &&
            scrollController.position.pixels >=
                scrollController.position.maxScrollExtent) {
          setState(() {
            isLoading = true;
            loadMoreData();
          });
        }
      });
  }

  @override
  void dispose() {
    super.dispose();
    scrollController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      controller: scrollController,
      child: Column(
        children: [
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            height: Sizes.default180,
            width: double.maxFinite,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(Sizes.default10)),
            child: CustomPaint(
                painter: _GroupCustomPainter(),
                child: Column(
                  children: [
                    Container(
                      height: Sizes.default40,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            'No.12',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797),
                          ),
                          Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.tightFor(
                                  width: Sizes.default70,
                                  height: Sizes.default25),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.parseColorFromHexString(
                                      '#fb8974'),
                                  borderRadius:
                                      BorderRadius.circular(Sizes.default10)),
                              child: InkWell(
                                  onTap: () {},
                                  child: Text.rich(TextSpan(children: [
                                    WidgetSpan(
                                        child: ToolsUtils.getUrlSvg(
                                            'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3116.svg',
                                            width: Sizes.default12,
                                            height: Sizes.default13),
                                        alignment: PlaceholderAlignment.middle),
                                    TextSpan(
                                        text: '审核中',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default12))
                                  ]))))
                        ],
                      ),
                    ),
                    Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default180 - Sizes.default90,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          GFImageOverlay(
                            width: Sizes.default70,
                            height: Sizes.default70,
                            image: ToolsUtils.assetImage('group_buy.jpg'),
                            borderRadius: BorderRadius.circular(Sizes.default5),
                          ),
                          Expanded(
                              child: Container(
                            padding:
                                const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '烤肉单人套餐',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333,
                                        fontSize: Sizes.default16),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: const EdgeInsets.symmetric(
                                      vertical: Sizes.default12),
                                  child: Text(
                                    '截至2021-02-20 | 周五 | 免预约',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797,
                                        fontSize: Sizes.default13),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text.rich(TextSpan(
                                      text: '￥49',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorCc0,
                                          fontSize: Sizes.default15),
                                      children: [
                                        TextSpan(
                                          text: '￥99',
                                          style: TextStyle(
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999),
                                              fontSize: Sizes.default12,
                                              fontFamily: Fonts.yaHei,
                                              fontWeight: Fonts.w4,
                                              decoration:
                                                  TextDecoration.lineThrough,
                                              decorationColor: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999)),
                                        )
                                      ])),
                                )
                              ],
                            ),
                          ))
                        ],
                      ),
                    ),
                    Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {}, child: const Text('')),
                          )),
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '编辑团购',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          ))
                        ],
                      ),
                    )
                  ],
                )),
          ),
          Container(
            margin: edgeInsets,
            height: Sizes.default180,
            width: double.maxFinite,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(Sizes.default10)),
            child: CustomPaint(
                painter: _GroupCustomPainter(),
                child: Column(
                  children: [
                    Container(
                      height: Sizes.default40,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            'No.11',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797),
                          ),
                          Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.tightFor(
                                  width: Sizes.default70,
                                  height: Sizes.default25),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(82, 190, 237, 1),
                                  borderRadius:
                                      BorderRadius.circular(Sizes.default10)),
                              child: InkWell(
                                  onTap: () {},
                                  child: Text.rich(TextSpan(children: [
                                    WidgetSpan(
                                        child: ToolsUtils.getUrlSvg(
                                            'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3057.svg',
                                            width: Sizes.default12,
                                            height: Sizes.default13),
                                        alignment: PlaceholderAlignment.middle),
                                    TextSpan(
                                        text: '未开始',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default12))
                                  ]))))
                        ],
                      ),
                    ),
                    Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default180 - Sizes.default90,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          GFImageOverlay(
                            width: Sizes.default70,
                            height: Sizes.default70,
                            image: ToolsUtils.assetImage('group_buy.jpg'),
                            borderRadius: BorderRadius.circular(Sizes.default5),
                          ),
                          Expanded(
                              child: Container(
                            padding:
                                const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '烤肉单人套餐',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333,
                                        fontSize: Sizes.default16),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: const EdgeInsets.symmetric(
                                      vertical: Sizes.default12),
                                  child: Text(
                                    '截至2021-02-20 | 周五 | 免预约',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797,
                                        fontSize: Sizes.default13),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text.rich(TextSpan(
                                      text: '￥49',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorCc0,
                                          fontSize: Sizes.default15),
                                      children: [
                                        TextSpan(
                                          text: '￥99',
                                          style: TextStyle(
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999),
                                              fontSize: Sizes.default12,
                                              fontFamily: Fonts.yaHei,
                                              fontWeight: Fonts.w4,
                                              decoration:
                                                  TextDecoration.lineThrough,
                                              decorationColor: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999)),
                                        )
                                      ])),
                                )
                              ],
                            ),
                          ))
                        ],
                      ),
                    ),
                    Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {
                                  openAlert('是否暂停此活动?');
                                },
                                child: Text(
                                  '暂停优惠',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          )),
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '编辑活动',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          ))
                        ],
                      ),
                    )
                  ],
                )),
          ),
          Container(
            margin: edgeInsets,
            height: Sizes.default180,
            width: double.maxFinite,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(Sizes.default10)),
            child: CustomPaint(
                painter: _GroupCustomPainter(),
                child: Column(
                  children: [
                    Container(
                      height: Sizes.default40,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            'No.09',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797),
                          ),
                          Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.tightFor(
                                  width: Sizes.default70,
                                  height: Sizes.default25),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(153, 153, 153, 1),
                                  borderRadius:
                                      BorderRadius.circular(Sizes.default10)),
                              child: InkWell(
                                  onTap: () {},
                                  child: Text.rich(TextSpan(children: [
                                    WidgetSpan(
                                        child: ToolsUtils.getUrlSvg(
                                            'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3057.svg',
                                            width: Sizes.default12,
                                            height: Sizes.default13),
                                        alignment: PlaceholderAlignment.middle),
                                    TextSpan(
                                        text: '已暂停',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default12))
                                  ]))))
                        ],
                      ),
                    ),
                    Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default180 - Sizes.default90,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          GFImageOverlay(
                            width: Sizes.default70,
                            height: Sizes.default70,
                            image: ToolsUtils.assetImage('group_buy.jpg'),
                            borderRadius: BorderRadius.circular(Sizes.default5),
                          ),
                          Expanded(
                              child: Container(
                            padding:
                                const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '烤肉单人套餐',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333,
                                        fontSize: Sizes.default16),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: const EdgeInsets.symmetric(
                                      vertical: Sizes.default12),
                                  child: Text(
                                    '截至2021-02-20 | 周一至周日 | 包间除外',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797,
                                        fontSize: Sizes.default13),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text.rich(TextSpan(
                                      text: '￥49',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorCc0,
                                          fontSize: Sizes.default15),
                                      children: [
                                        TextSpan(
                                          text: '￥99',
                                          style: TextStyle(
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999),
                                              fontSize: Sizes.default12,
                                              fontFamily: Fonts.yaHei,
                                              fontWeight: Fonts.w4,
                                              decoration:
                                                  TextDecoration.lineThrough,
                                              decorationColor: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999)),
                                        )
                                      ])),
                                )
                              ],
                            ),
                          ))
                        ],
                      ),
                    ),
                    Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {
                                  openAlert('是否恢复此活动?');
                                },
                                child: Text(
                                  '恢复优惠',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          )),
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '编辑活动',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          ))
                        ],
                      ),
                    )
                  ],
                )),
          ),
          Container(
            margin: edgeInsets,
            height: Sizes.default180,
            width: double.maxFinite,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(Sizes.default10)),
            child: CustomPaint(
                painter: _GroupCustomPainter(),
                child: Column(
                  children: [
                    Container(
                      height: Sizes.default40,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            'No.08',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797),
                          ),
                          Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.tightFor(
                                  width: Sizes.default70,
                                  height: Sizes.default25),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(0, 102, 204, 1),
                                  borderRadius:
                                      BorderRadius.circular(Sizes.default10)),
                              child: InkWell(
                                  onTap: () {},
                                  child: Text.rich(TextSpan(children: [
                                    WidgetSpan(
                                        child: ToolsUtils.getUrlSvg(
                                            'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3057.svg',
                                            width: Sizes.default12,
                                            height: Sizes.default13),
                                        alignment: PlaceholderAlignment.middle),
                                    TextSpan(
                                        text: '进行中',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default12))
                                  ]))))
                        ],
                      ),
                    ),
                    Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default180 - Sizes.default90,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          GFImageOverlay(
                            width: Sizes.default70,
                            height: Sizes.default70,
                            image: ToolsUtils.assetImage('group_buy.jpg'),
                            borderRadius: BorderRadius.circular(Sizes.default5),
                          ),
                          Expanded(
                              child: Container(
                            padding:
                                const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '烤肉单人套餐',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333,
                                        fontSize: Sizes.default16),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: const EdgeInsets.symmetric(
                                      vertical: Sizes.default12),
                                  child: Text(
                                    '截至2021-02-20 | 周一、周三、周五、周六、周日 | 要预约、包间可用',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797,
                                        fontSize: Sizes.default13),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text.rich(TextSpan(
                                      text: '￥49',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorCc0,
                                          fontSize: Sizes.default15),
                                      children: [
                                        TextSpan(
                                          text: '￥99',
                                          style: TextStyle(
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999),
                                              fontSize: Sizes.default12,
                                              fontFamily: Fonts.yaHei,
                                              fontWeight: Fonts.w4,
                                              decoration:
                                                  TextDecoration.lineThrough,
                                              decorationColor: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999)),
                                        )
                                      ])),
                                )
                              ],
                            ),
                          ))
                        ],
                      ),
                    ),
                    Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '暂停优惠',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          )),
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '查看详情',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          ))
                        ],
                      ),
                    )
                  ],
                )),
          ),
          Container(
            margin: edgeInsets,
            height: Sizes.default180,
            width: double.maxFinite,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(Sizes.default10)),
            child: CustomPaint(
                painter: _GroupCustomPainter(),
                child: Column(
                  children: [
                    Container(
                      height: Sizes.default40,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            'No.07',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797),
                          ),
                          Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.tightFor(
                                  width: Sizes.default70,
                                  height: Sizes.default25),
                              decoration: BoxDecoration(
                                  color: ColorsUtils.rgba(204, 204, 204, 1),
                                  borderRadius:
                                      BorderRadius.circular(Sizes.default10)),
                              child: InkWell(
                                  onTap: () {},
                                  child: Text.rich(TextSpan(children: [
                                    WidgetSpan(
                                        child: ToolsUtils.getUrlSvg(
                                            'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3057.svg',
                                            width: Sizes.default12,
                                            height: Sizes.default13),
                                        alignment: PlaceholderAlignment.middle),
                                    TextSpan(
                                        text: '已结束',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default12))
                                  ]))))
                        ],
                      ),
                    ),
                    Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default180 - Sizes.default90,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          GFImageOverlay(
                            width: Sizes.default70,
                            height: Sizes.default70,
                            image: ToolsUtils.assetImage('group_buy.jpg'),
                            borderRadius: BorderRadius.circular(Sizes.default5),
                          ),
                          Expanded(
                              child: Container(
                            padding:
                                const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '烤肉单人套餐',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333,
                                        fontSize: Sizes.default16),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: const EdgeInsets.symmetric(
                                      vertical: Sizes.default12),
                                  child: Text(
                                    '截至2021-02-20 | 周一至周日',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797,
                                        fontSize: Sizes.default13),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text.rich(TextSpan(
                                      text: '￥49',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorCc0,
                                          fontSize: Sizes.default15),
                                      children: [
                                        TextSpan(
                                          text: '￥99',
                                          style: TextStyle(
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999),
                                              fontSize: Sizes.default12,
                                              fontFamily: Fonts.yaHei,
                                              fontWeight: Fonts.w4,
                                              decoration:
                                                  TextDecoration.lineThrough,
                                              decorationColor: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999)),
                                        )
                                      ])),
                                )
                              ],
                            ),
                          ))
                        ],
                      ),
                    ),
                    Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '继续发布',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          )),
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '查看详情',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          ))
                        ],
                      ),
                    )
                  ],
                )),
          ),
          Container(
            margin: edgeInsets,
            height: Sizes.default180,
            width: double.maxFinite,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(Sizes.default10)),
            child: CustomPaint(
                painter: _GroupCustomPainter(),
                child: Column(
                  children: [
                    Container(
                      height: Sizes.default40,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            'No.06',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797),
                          ),
                          Expanded(
                              child: Wrap(
                            alignment: WrapAlignment.end,
                            crossAxisAlignment: WrapCrossAlignment.center,
                            spacing: Sizes.default10,
                            children: [
                              IconButton(
                                  onPressed: () {},
                                  icon: Icon(
                                    AntdIcons.questionCircle,
                                    color: ColorsUtils.parseColorFromHexString(
                                        '#BFBFBF'),
                                    size: Sizes.default13,
                                  )),
                              Container(
                                  alignment: Alignment.center,
                                  constraints: const BoxConstraints.tightFor(
                                      width: Sizes.default80,
                                      height: Sizes.default25),
                                  decoration: BoxDecoration(
                                      color: ColorsUtils.rgba(255, 0, 0, 1),
                                      borderRadius: BorderRadius.circular(
                                          Sizes.default10)),
                                  child: InkWell(
                                      onTap: () {},
                                      child: Text.rich(TextSpan(children: [
                                        WidgetSpan(
                                            child: ToolsUtils.getUrlSvg(
                                                'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3057.svg',
                                                width: Sizes.default12,
                                                height: Sizes.default13),
                                            alignment:
                                                PlaceholderAlignment.middle),
                                        TextSpan(
                                            text: '审核失败',
                                            style: StylesUtils.customTextStyle(
                                                fontSize: Sizes.default12))
                                      ]))))
                            ],
                          )),
                        ],
                      ),
                    ),
                    Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default180 - Sizes.default90,
                      padding: const EdgeInsets.symmetric(
                          horizontal: Sizes.default10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          GFImageOverlay(
                            width: Sizes.default70,
                            height: Sizes.default70,
                            image: ToolsUtils.assetImage('group_buy.jpg'),
                            borderRadius: BorderRadius.circular(Sizes.default5),
                          ),
                          Expanded(
                              child: Container(
                            padding:
                                const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '烤肉单人套餐',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color333,
                                        fontSize: Sizes.default16),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: const EdgeInsets.symmetric(
                                      vertical: Sizes.default12),
                                  child: Text(
                                    '截至2021-02-20 | 周一至周日',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color797,
                                        fontSize: Sizes.default13),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child: Text.rich(TextSpan(
                                      text: '￥49',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorCc0,
                                          fontSize: Sizes.default15),
                                      children: [
                                        TextSpan(
                                          text: '￥99',
                                          style: TextStyle(
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999),
                                              fontSize: Sizes.default12,
                                              fontFamily: Fonts.yaHei,
                                              fontWeight: Fonts.w4,
                                              decoration:
                                                  TextDecoration.lineThrough,
                                              decorationColor: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color999)),
                                        )
                                      ])),
                                )
                              ],
                            ),
                          ))
                        ],
                      ),
                    ),
                    Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          )),
                          Expanded(
                              child: Center(
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '编辑活动',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color333,
                                      fontSize: Sizes.default15),
                                )),
                          ))
                        ],
                      ),
                    )
                  ],
                )),
          ),
          renderBottom(),
        ],
      ),
    );
  }

  EdgeInsets get edgeInsets {
    return const EdgeInsets.only(
        left: Sizes.default20, right: Sizes.default20, bottom: Sizes.default20);
  }

  Widget renderBottom() {
    if (noMore) {
      return Container(
        padding: const EdgeInsets.symmetric(vertical: 15),
        alignment: Alignment.center,
        child: Text(
          '- 已显示全部数据 -',
          style: StylesUtils.customTextStyle(
              color: ColorsUtils.color797, fontSize: Sizes.default15),
        ),
      );
    }
    if (isLoading) {
      return Container(
        padding: const EdgeInsets.symmetric(vertical: 15),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              '努力加载中...',
              style: StylesUtils.customTextStyle(
                  color: ColorsUtils.color797, fontSize: Sizes.default15),
            ),
            const Padding(padding: EdgeInsets.only(left: 10)),
            const SizedBox(
              width: 20,
              height: 20,
              child: CircularProgressIndicator(strokeWidth: 3),
            ),
          ],
        ),
      );
    } else {
      return Container(
        padding: const EdgeInsets.symmetric(vertical: 15),
        alignment: Alignment.center,
        child: Text(
          '上拉加载更多',
          style: StylesUtils.customTextStyle(
              color: ColorsUtils.color797, fontSize: Sizes.default15),
        ),
      );
    }
  }

  void loadMoreData() {
    Future.delayed(const Duration(seconds: 1), () {
      setState(() {
        noMore = true;
        isLoading = false;
      });
    });
  }

  void openAlert(String title) async {
    final dialog = BrnDialog(
        verticalDivider: const VerticalDivider(
          width: 1.0,
          color: Colors.black,
        ),
        divider: const Divider(
          height: 1.0,
          color: Colors.black,
        ),
        contentWidget: ListBody(
          children: [
            Container(
              padding: const EdgeInsets.only(bottom: Sizes.default15),
              alignment: Alignment.center,
              child: Text(
                title,
                style: StylesUtils.customTextStyle(
                    color: ColorsUtils.color515, fontSize: Sizes.default15),
              ),
            ),
          ],
        ),
        actionsWidget: [
          Container(
              alignment: Alignment.center,
              child: TextButton(
                onPressed: () {
                  Navigator.pop(context, 0);
                },
                child: Text(
                  '取消',
                  style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color333, fontSize: Sizes.default16),
                ),
              )),
          Container(
              alignment: Alignment.center,
              child: TextButton(
                onPressed: () {
                  Navigator.pop(context, 1);
                },
                child: Text('确定',
                    style: StylesUtils.customTextStyle(
                        fontSize: Sizes.default16,
                        color: ColorsUtils.colorFf6)),
              ))
        ],
        themeData: BrnDialogConfig(
            dialogWidth: 280,
            radius: Sizes.default10,
            titlePaddingSm: EdgeInsets.zero,
            titlePaddingLg: EdgeInsets.zero,
            contentPaddingSm: EdgeInsets.zero,
            contentPaddingLg: EdgeInsets.zero,
            contentTextAlign: TextAlign.center));
    int? result = await showDialog<int>(
      context: context,
      barrierDismissible: true,
      builder: (BuildContext context) {
        return dialog;
      },
    );
    if (result == 1) {
      /// 表示确定
    }
  }
}

class _GroupCustomPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    Rect rect = Offset.zero & size;
    var paint = Paint()
      ..isAntiAlias = false
      ..style = PaintingStyle.stroke
      ..color = ToolsUtils.getDefaultBackgroundColor()
      ..strokeJoin = StrokeJoin.round
      ..strokeWidth = 1;
    _drawDashLine(canvas, Offset(12 / 2 + 6, rect.height - 50),
        Offset(rect.width - 12 / 2 - 6, rect.height - 50), paint);
    var arc = Paint()
      ..isAntiAlias = false
      ..style = PaintingStyle.fill
      ..color = ToolsUtils.getDefaultBackgroundColor();
    canvas.drawArc(
        Rect.fromCenter(
          center: Offset(0, rect.height - 50),
          width: 16,
          height: 16,
        ),
        pi * 3 / 2,
        pi,
        false,
        arc);
    canvas.drawArc(
        Rect.fromCenter(
          center: Offset(rect.width, rect.height - 50),
          width: 16,
          height: 16,
        ),
        pi / 2,
        pi,
        false,
        arc);
  }

 void _drawPath(Rect rect) {
    var path = Path();
    path.fillType = PathFillType.evenOdd;
    path.addRect(rect);
    _formHoldLeft(path, rect);
    _formHoldRight(path, rect);
  }

  _formHoldLeft(Path path, Rect rect) {
    path.addArc(
        Rect.fromCenter(
          center: Offset(0, rect.height - 50),
          width: 16,
          height: 16,
        ),
        pi * 3 / 2,
        pi);
  }

  _formHoldRight(Path path, Rect rect) {
    path.addArc(
        Rect.fromCenter(
          center: Offset(rect.width, rect.height - 50),
          width: 16,
          height: 16,
        ),
        pi / 2,
        pi);
  }

  _drawDashLine(Canvas canvas, Offset start, Offset end, Paint paint) {
    double currentLength = start.dx;
    while (currentLength <= end.dx) {
      Offset lineStart = Offset(currentLength, start.dy);
      Offset lineEnd = Offset(currentLength + 3, start.dy);
      canvas.drawLine(lineStart, lineEnd, paint);
      currentLength += 7;
    }
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return true;
  }
}
